home *** CD-ROM | disk | FTP | other *** search
/ PC Direct 1998 August / PC Direct August 1998.iso / S / powerj / Product / hpp.z / WACCEL.HPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-11-25  |  3.7 KB  |  121 lines

  1. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2.    %     Copyright (C) 1994, by WATCOM International Inc.  All rights    %
  3.    %     reserved.  No part of this software may be reproduced or        %
  4.    %     used in any form or by any means - graphic, electronic or       %
  5.    %     mechanical, including photocopying, recording, taping or        %
  6.    %     information storage and retrieval systems - except with the     %
  7.    %     written permission of WATCOM International Inc.                 %
  8.    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  9. */
  10.  
  11. #ifndef _WACCEL_HPP_INCLUDED
  12. #define _WACCEL_HPP_INCLUDED
  13. #pragma once
  14.  
  15. #ifndef _WNO_PRAGMA_PUSH
  16. #pragma pack(push,8);
  17. #pragma enum int;
  18. #endif
  19.  
  20. #ifndef _WDEF_HPP_INCLUDED
  21. #  include "wdef.hpp"
  22. #endif
  23. #ifndef _WOBJECT_HPP_INCLUDED
  24. #  include "wobject.hpp"
  25. #endif
  26. #ifndef _WKEYDEFS_HPP_INCLUDED
  27. #  include "wkeydefs.hpp"
  28. #endif
  29. #ifndef _WRESID_HPP_INCLUDED
  30. #  include "wresid.hpp"
  31. #endif
  32.  
  33. class WWindow;
  34. class WMenu;
  35. class WAcceleratorReference;
  36.  
  37. enum WAcceleratorHandle   { NULLHACCEL = 0, LASTHACCEL = LAST_16TO32BIT };
  38.  
  39. class WCMCLASS WAcceleratorTable : public WObject {
  40.     WDeclareSubclass( WAcceleratorTable, WObject );
  41.  
  42.     public:
  43.  
  44.         /*************************************************************
  45.          * Constructors and destructors
  46.          *************************************************************/
  47.  
  48.         WAcceleratorTable();
  49.  
  50.         WAcceleratorTable( const WAcceleratorTable & table );
  51.  
  52.         WAcceleratorTable( WAcceleratorHandle handle,
  53.                            WBool destroyTable=FALSE );
  54.  
  55.         WAcceleratorTable( const WResourceID & id,
  56.                            WModuleHandle module=_ApplicationModule );
  57.  
  58.         ~WAcceleratorTable();
  59.  
  60.         /*************************************************************
  61.          * Properties
  62.          *************************************************************/
  63.  
  64.         // Handle
  65.  
  66.         WAcceleratorHandle GetHandle() const;
  67.  
  68.         /*************************************************************
  69.          * Methods
  70.          *************************************************************/
  71.  
  72.         // Add
  73.         //
  74.         //    Adds a new accelerator key to the accelerator table.
  75.         //    Note that this causes the old table to be destroyed
  76.         //    and a new one created.
  77.  
  78.         WBool Add( WKeyState state, WKeyPressCode code,
  79.                    WUShort accelID=0, WBool noInvert=FALSE );
  80.         WBool Add( const WAcceleratorTable & table );
  81.  
  82.         // AppendToMenuItems
  83.         //
  84.         //    Given a menu, adds accelerators to the captions for
  85.         //    the menuitems that correspond to accelerators in
  86.         //    the accelerator table.
  87.  
  88.         WBool AppendToMenuItems( WMenu *menu );
  89.  
  90.         // Clear
  91.  
  92.         void Clear();
  93.  
  94.         // Create
  95.  
  96.         WBool Create( const WAcceleratorTable & table );
  97.         WBool Create( WAcceleratorHandle handle, WBool destroyTable=FALSE );
  98.         WBool Create( const WResourceID & id, WModuleHandle module=_ApplicationModule );
  99.  
  100.         /**********************************************************
  101.          * Operators
  102.          *********************************************************/
  103.  
  104.         WAcceleratorTable & operator=( const WAcceleratorTable & t );
  105.  
  106.         /*************************************************************
  107.          * Data members
  108.          *************************************************************/
  109.  
  110.     private:
  111.  
  112.         WAcceleratorReference * _ref;
  113. };
  114.  
  115. #ifndef _WNO_PRAGMA_PUSH
  116. #pragma enum pop;
  117. #pragma pack(pop);
  118. #endif
  119.  
  120. #endif // _WACCEL_HPP_INCLUDED
  121.